<?php

    class prices_model extends MY_Model
    {
        function __construct()
        {
            parent::__construct();
            $this->table = 'prices';
        }

        function find_all_prices($rooms_ID)
        {
            
            $q = "
            SELECT ID, 
            selling_min_person, selling_min_ng, selling_periods,
            net_min_person, net_min_ng, net_periods,
            margin_min_person, margin_min_ng, margin_periods,
            rooms_ID
            FROM prices
            WHERE rooms_ID =  $rooms_ID
            ORDER BY selling_min_person ASC, selling_min_ng ASC
            ";

            $res = $this->db->query($q)->result_array();
            //$this->firephp->log($this->db->last_query());
            return $res;
        }

        function delete_all($rooms_ID)
        {
            $q = "
            DELETE FROM prices
            WHERE rooms_ID =  $rooms_ID
            ";

            $res = $this->db->query($q);
            return $res;
        }

    }

?>
